import { request } from '@/utils/request'

import type { DepartmentList, ManagerList, OperateForm, DetailData } from '@/types/departments'

export function getDepartmentListApi() {
  return request<DepartmentList>('/company/department', 'get')
}

export function getManagerListApi() {
  return request<ManagerList>('/sys/user/simple', 'get')
}

export function delDepartmentApi(id: string) {
  return request(`/company/department/${id}`, 'delete')
}

export function addDepartmentApi(data: OperateForm) {
  return request(`/company/department`, 'post', data)
}

export function getDepartmentDetailApi(id: string) {
  return request<DetailData>(`/company/department/${id}`, 'get')
}

export function editDepartmentApi(id: string, data: OperateForm) {
  return request(`/company/department/${id}`, 'put', data)
}
